<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  document.addEventListener('keypress', function (e) {
    console.log('keypress触发' + e.keyCode);
  })
  document.addEventListener('keydown', function () {
    console.log('keydown触发');
  })
  document.addEventListener('keyup', function () {
    console.log('keyup触发');
  })
</script>
</body>
</html>